package client

import java.net.InetSocketAddress

import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.ipc.RPC
import protocol.Info

import scala.io.StdIn.readLine


object Client {

  def main(args: Array[String]): Unit = {
    // 创建 RPC 代理类并指定服务端地址为本地 65530 端口
    val client = RPC.getProxy(classOf[Info],
      1L,
      new InetSocketAddress("0.0.0.0", 65530),
      new Configuration())

    // 以交互式方式输入学号
    while (true) {
      print("Please enter your Student Number: ")
      val line = readLine()
      println(client.findName(line))
    }
  }

}
